<template>
  <div>
    <div>第一个分身屏幕</div>
    <div>
      <a-input v-model:model-value="inputValue" placeholder="这里的输入会共享到其他屏幕" allow-clear @input="onInput" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { MultAPISender,MultAPIListener } from '@/ipc-event-names/mult';
import { ref } from 'vue';

const inputValue = ref('');

/**
 * 响应输入
 * @param value 
 */
function onInput(value: string) {
  window[MultAPISender].sendMessageToAll(value);
}

/**
 * 接收广播消息
 * @param message 
 */
function onBroadcast(message:string) {
  inputValue.value = message;
}

window[MultAPIListener].onBroadcast(onBroadcast);

</script>

<style scoped lang="scss"></style>
